Copyright: ToolButton by Brett Foster 1992


ToolButton Control

Tool Button

Description

A tool button displays a graphical button face from a standard set or a custom set.  It can behave as either a command button, or an attribute button.

Remarks

Use the ButtonSource property to choose between the standard set of button faces and the custom set; use the ButtonType property to select the button behavior.

The Picture property represents the custom set of button faces.  It may be set to (none) or (Bitmap); metafile and icon formats are not supported.  If it is set to (Bitmap), the picture must be a horizontal sequence of button faces.  Use the CustomCount property to indicate the number of button faces in the custom set, and the CustomButton property to select which button face to display.  Setting the Picture property automatically resets the CustomCount and CustomButton properties to zero.

Note: Non-standard properties are preceded by an asterisk (*) in the list below.

Properties

AutoSize BackColor *ButtonSource *ButtonType CtlName *CustomButton *CustomCount DragIcon	DragMode Enabled Height hWnd Index Left MousePointer Parent	Picture *StandardButton Tag Top *Value Visible Width
Events

Click DblClick DragDrop	DragOver MouseDown	MouseMove MouseUp
Methods

Drag	Move	Refresh


ButtonSource Property

Applies To

ToolButton

Description

Sets or returns the source of the displayed button face.

Usage

[form.]toolbutton.ButtonSource[ = source%]

Remarks

The ButtonSource property settings are:

Setting	Description

0	(Default) Standard.  The button face will be taken from the StandardButton property.

1	Custom.  The button face will be taken from the CustomButton property.

If ButtonSource is changed from 1 (custom) to 0 (standard), several other properties are reset to insure their validity:

 AutoSize is set to -1 (true)

 ButtonType is set to 0 (command)

 Value is set to 0 (up)

Data Type

Integer (Enumerated)


ButtonType Property

Applies To

ToolButton

Description

Sets or returns the type of button.

Usage

[form.]toolbutton.ButtonType[ = type%]

Remarks

The ButtonType property settings are:

Setting	Description

0	(Default) Command.  Remains in the up position after being clicked.

1	Attribute.  Alternates between up and down when clicked.

ButtonType may only be set to 1 (attribute) if the ButtonSource property is set to 1 (custom).  The standard buttons are all command buttons.  If ButtonType is set to 0 (command), Value is automatically reset to 0 (up).

Data Type

Integer (Enumerated)


CustomButton Property

Applies To

ToolButton

Description

Sets or returns the custom button face to be displayed.

Usage

[form.]toolbutton.CustomButton[ = button%]

Remarks

The CustomButton property determines which button face to display from the custom set.

The valid range for button is 0 - CustomCount inclusive.  A value of 0 indicates that a blank button face will be used.

Data Type

Integer


CustomCount Property

Applies To

ToolButton

Description

Sets or returns the number of button faces in the custom set.

Usage

[form.]toolbutton.CustomCount[ = count%]

Remarks

The CustomCount property defines the valid range of values for the CustomButton property.  It must evenly divide the Picture width.

Data Type

Integer


StandardButton Property

Applies To

ToolButton

Description

Sets or returns the standard button face to be displayed.

Usage

[form.]toolbutton.StandardButton[ = button%]

Remarks

The StandardButton property settings are:

Setting	Description

0	 (Default) Blank

1	 Edit Cut

2	 Edit Copy

3	 Edit Paste

4	 File New

5	 File Open

6	 File Save

7	 File Print

8	 Help

9	 Context-Sensitive Help

Data Type

Integer (Enumerated)


Value Property

Applies To

ToolButton

Description

Sets or returns the button state.

Usage

[form.]toolbutton.Value[ = state%]

Remarks

The Value property settings are:

Setting	Description

0	(Default) Up

1	Down

2	Indeterminate

The Value settings are treated differently depending on the value of the ButtonType property.  For a command button, the button state is always 0 (up).  Setting Value to 1 (down) in code invokes the button's Click event, but does not actually change Value.  Setting value to 0 (up) has no effect, and attempting to set it to 2 (indeterminate) results in an error.

For an attribute button, Value automatically changes when the user clicks on the button.  If the Value is 1 (down) when the button is clicked, Value will be changed to 0 (up); otherwise, it will be changed to 1 (down).  Value may also be set from code, but it never invokes a Click event.

The indeterminate state is useful to indicate special attribute conditions.  Consider a button to represent the "bold" attribute in a word processor; if the user selects a block of text which contains some bold characters and some non-bold characters, it is not appropriate to display the button as either down or up.  Instead, the indeterminate state is used.

Data Type

Integer (Enumerated)